package com.lvy.hczn.front.system.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lvy.hczn.front.common.exception.UtilException;
import com.lvy.hczn.front.system.domain.business.WarehouseTemperatureZone;
import com.lvy.hczn.front.system.mapper.WarehouseTemperatureZoneMapper;
import com.lvy.hczn.front.system.service.WarehouseTemperatureZoneService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class WarehouseTemperatureZoneServiceImpl extends ServiceImpl<WarehouseTemperatureZoneMapper, WarehouseTemperatureZone> implements WarehouseTemperatureZoneService {

    @Autowired
    private WarehouseTemperatureZoneMapper warehouseTemperatureZoneMapper;

    /**
     * 列表查询
     *
     * @param warehouseTemperatureZone
     * @return java.util.List<com.lvy.hczn.front.system.domain.business.WarehouseTemperatureZone>
     * @author yw
     * @date 2023-11-09 14:33:19
     */
    @Override
    public List<WarehouseTemperatureZone> selectList(WarehouseTemperatureZone warehouseTemperatureZone) {
        if (StrUtil.isEmpty(warehouseTemperatureZone.getWarehouseId())) {
            throw new UtilException("仓库ID为空");
        }
        if (warehouseTemperatureZone.getZoneCodeList() == null || warehouseTemperatureZone.getZoneCodeList().isEmpty()) {
            throw new UtilException("温区编号为空");
        }
        if (warehouseTemperatureZone.getWarehouseRow() == null) {
            throw new UtilException("仓库行号为空");
        }
        return warehouseTemperatureZoneMapper.selectList(warehouseTemperatureZone);
    }
}
